from selenium.webdriver.support.ui import WebDriverWait

class LoginHandler:
    # 登录处理类
    def __init__(self, driver):
        self.driver = driver
    
    def manual_login(self):
        print("请登录B站...")
        self.driver.get("https://passport.bilibili.com/login")
        
        wait = WebDriverWait(self.driver, 300)
        try:
            wait.until(lambda d: "bilibili.com" in d.current_url and "login" not in d.current_url)
            print("登录成功！")
            return True
        except:
            print("登录超时或失败")
            return False